package com.woodws.fresh.im.config

import com.alibaba.cloud.nacos.discovery.NacosServiceDiscovery
import com.woodws.fresh.common.core.extra.log
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.ApplicationArguments
import org.springframework.boot.ApplicationRunner
import org.springframework.boot.autoconfigure.AutoConfigureAfter
import org.springframework.stereotype.Component

@Component
class FreshImRegisterServer(
    val nacosServiceDiscovery: NacosServiceDiscovery
    ) : ApplicationRunner {

    @Value("\${spring.application.name}")
    private var serviceId: String = "fresh-im"

    override fun run(args: ApplicationArguments) {
        val serviceInstance = nacosServiceDiscovery.getInstances(serviceId)
        log.info(serviceInstance.toString())
    }
}